package com.svms.utils;

import java.util.List;

import org.zkoss.util.resource.Labels;
import org.zkoss.zul.Messagebox;

public class SvmsMessageUtils extends Messagebox {

	/**
	 * To show the error messages in a messasge Dialgoue
	 * 
	 * @param message
	 */
	public static void showErrorMessage(String message) {
		show(message, "Error", Messagebox.OK, Messagebox.ERROR, 0, null);
	}

	/**
	 * To show the error messages in a messasge Dialgoue
	 * 
	 * @param message
	 */
	public static void showErrorMessageFromLable(String message) {
		show(Labels.getLabel(message), "Error", Messagebox.OK,
				Messagebox.ERROR, 0, null);
	}

	/**
	 * To show the error messages in a messasge Dialgoue
	 * 
	 * @param message
	 */
	public static void showErrorMessageFromLable(List<String> messages) {
		StringBuffer errors = new StringBuffer();
		for (String errorMessage : messages) {
			errors.append("\n");
			errors.append(Labels.getLabel(errorMessage));
			errors.append("\n");
		}
		show(errors.toString(), "Error", Messagebox.OK, Messagebox.ERROR, 0,
				null);
	}

	/**
	 * To show the Success messages in a messasge Dialgoue
	 * 
	 * @param message
	 */
	public static void showSuccessMessage(String message) {
		show(message, "Success", Messagebox.OK, Messagebox.EXCLAMATION, 0, null);
	}

	/**
	 * To show the a generic messages in a messasge Dialgoue
	 * 
	 * @param message
	 */
	public static void showGenericMessage(String message) {
		show(message, "Help", Messagebox.OK, Messagebox.INFORMATION, 0, null);
	}

}
